package units.monster;

///* ----------------------------------------------------------------------
// *	Shadow Quest
// *	Copyright (C) 2009 Prageeth Silva <prageeth@thenewcoders.com>
// *
// *  This program is free software: you can redistribute it and/or modify
// *  it under the terms of the GNU General Public License as published by
// *  the Free Software Foundation, either version 3 of the License, or
// *  (at your option) any later version.
// *
// *  This program is distributed in the hope that it will be useful,
// *  but WITHOUT ANY WARRANTY; without even the implied warranty of
// *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// *  GNU General Public License for more details.
// *
// *  You should have received a copy of the GNU General Public License
// *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
// *  ----------------------------------------------------------------------
// */
//
//package units.monster;
//
//import map.World;
//
//import org.newdawn.slick.Input;
//import org.newdawn.slick.SlickException;
//
//import units.Unit;
//import units.allies.Ally;
//
//
///** Represents the Monster character.
// * 
// */
//public class CopyOfMonster extends Unit
//{
//	
//	public static int DEFAULT_FRAME_WIDTH = 72, DEFAULT_FRAME_HEIGHT = 72;
//	
//	public static int 	ZOMBIE_MAX_HP = 60, ZOMBIE_DAMAGE = 10, ZOMBIE_RANGE_DAMAGE = 0, ZOMBIE_COOLDOWN = 800,
//						BANDIT_MAX_HP = 40, BANDIT_DAMAGE = 8, BANDIT_RANGE_DAMAGE = 0, BANDIT_COOLDOWN = 200,
//						SKELETON_MAX_HP = 100, SKELETON_DAMAGE = 16, SKELETON_RANGE_DAMAGE = 0, SKELETON_COOLDOWN = 500;
//	
//	private static CopyOfMonster leader;
//	
//	// the type of the monster
//	public enum MonsterType { ZOMBIE, BANDIT, SKELETON, LEADER, FLYING }
//	
//	private MonsterType type;
//	
//    /** Create a new Monster object (overload).
//	 * @param type The Monster type
//	 * @param width The width of the monster
//	 * @param height The height of the monster
//     */
//    public CopyOfMonster(MonsterType type, int width, int height)
//    throws SlickException
//    {
//    	this(type,width,height,DEFAULT_MAX_HP);
//    }
//    
//	/** Create a new Monster object
//	 * @param type The Monster type
//	 * @param width The width of the monster
//	 * @param height The height of the monster
//	 * @param maxHP The maximum HP of the monster
//     */
//    public CopyOfMonster(MonsterType type, int width, int height, int maxHP)
//    throws SlickException
//    {
//    	// temporarily make the super class and then replace the images
//    	super(width,height,maxHP);
//    	this.setMonsterType(type);
//    	
//    	String dirPath = "";
//    	
//    	switch (type) {
//			case ZOMBIE:
//				dirPath = "assets/units/monsters/zombie/";
//				this.setMaxHP(ZOMBIE_MAX_HP);
//				this.setHP(ZOMBIE_MAX_HP);
//				this.setDamage(ZOMBIE_DAMAGE);
//				this.setDamage(100);    // testing
//				this.setRangeDamage(ZOMBIE_RANGE_DAMAGE);
//				this.setMaxCoolDown(ZOMBIE_COOLDOWN);
//				this.setName("Zombie");
//				break;
//	 		case BANDIT:
//	 			dirPath = "assets/units/monsters/bandit/";
//				this.setMaxHP(BANDIT_MAX_HP);
//				this.setHP(BANDIT_MAX_HP);
//	 			this.setDamage(BANDIT_DAMAGE);
//				this.setRangeDamage(BANDIT_RANGE_DAMAGE);
//				this.setMaxCoolDown(BANDIT_COOLDOWN);
//				this.setName("Bandit");
//				break;
//	  		case SKELETON:
//	  			dirPath = "assets/units/monsters/skeleton/";
//				this.setMaxHP(SKELETON_MAX_HP);
//				this.setHP(SKELETON_MAX_HP);
//	  			this.setDamage(SKELETON_DAMAGE);
//				this.setRangeDamage(SKELETON_RANGE_DAMAGE);
//				this.setMaxCoolDown(SKELETON_COOLDOWN);
//				this.setName("Skeleton");
//				break;    		
//	  		case LEADER:
//	  			CopyOfMonster.setLeader(this);
//				break;
//	  		case FLYING:
//	  			this.setAttackType(Unit.AttackType.AIR);
//				break;
//    	}
//    	
//    	switch (type) {
//    	
//			case FLYING:
//			case LEADER:
//				break;
//				
//			default:
//				this.loadImages(dirPath);
//	    		// make the monster look in random directions
//	    		this.standInRandomDirection();	
//	    		break;
//	    		
//    	}
//    	
//    }
//    
//    /** Update the player's state for a frame.
//     * @param world A reference to the world.
//     * @param input The input object, used to take the keyboard inputs.
//     * @param delta Time passed since last frame (milliseconds).
//     */
//    public void update(World world, Input input, int delta) {
//    	
//    	if (this.isAlive()) {
//    		
//	    	this.setCoolDown(this.getCoolDown()-delta);
//	    	if (this.getCoolDown()<0) { this.setCoolDown(0); }
//	    	this.setTempX(0);
//	    	this.setTempY(0);
//	    	
//	    	if (!this.isDieing()) {
//	    		
//	    		boolean busy = this.checkUnitToFight(world,world.getPlayer(),delta);
//	    		
//	    		if (Ally.isHelping() && !this.isAttacking()) {
//		    		for (Ally a : world.getAllies()) {
//		    			busy |= this.checkUnitToFight(world,a,delta);
//		    			if (this.isAttacking()) { break; }
//		    		}
//	    		}
//	    		
//	    		if (!this.isAttacking() && busy) {
//	    			this.move(this.getTempX()*delta, this.getTempY()*delta, world);
//	    		} else {
//	    			this.idle(delta);
//	    		}
//	    		
//    		} else {
//    			
//    			this.checkDieing(false);
//    			
//	        }
//	    	
//    	}
//    	
//    	super.update(world, input, delta);
//        	
//    }
//    
//    
//    /* Getter and Setters beyond this point. */
//    
//    /** Get the Monster type.
//     * @return The monster type.
//     */
//    public MonsterType getMonsterType() {
//		return this.type;
//	}
//
//    /** Set the Monster type.
//     * @param type The monster type.
//     */
//	protected void setMonsterType(MonsterType type) {
//		this.type = type;
//	}  
//	
//	public static CopyOfMonster getLeader() {
//		return leader;
//	}
//
//	public static void setLeader(CopyOfMonster leader) {
//		CopyOfMonster.leader = leader;
//	}
//    
//}
